<?php
namespace ZHMVC\B\BXUNI;
class Wenzhang
{
    private $_pagesjson=ZH_PATH."/bzuni/pages.json";
    private $_content="";
    private $_AppName="";
    
    function __construct()
    {
        
    }
    
    public function getAppName()
    {
        return $this->_AppName;
    }
    
    
    public function setAppName($_AppName)
    {
        $this->_AppName = $_AppName;
    }
    
    public function parse() {
        //生成配置文件
        $this->makePageJson();
        //生成其他页面文件
        $this->makePages();
    }
    
    private function makePageJson()
    {
        $_pagesjsonTemplate='{
	"pages": [
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "{@#Appname#@}"
			}
		},
		{@#oterpage#@}
	],
	"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "{@#Appname#@}",
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8"
	},
	{@#tabBar#@}
	"uniIdRouter": {}
}
';
        $tabBar='"tabBar": {
		"iconWidth": "24px",
		"color": "#6c6c6c",
		"selectedColor": "#DD524D",
		"borderStyle": "black",
		"backgroundColor": "#ffffff",
		"list": [{
				"pagePath": "pages/index/index",
				"iconPath": "static/tab/tab-home.png",
				"selectedIconPath": "static/tab/tab-home-current.png",
				"text": "首页"
			},
			{
				"pagePath": "pages/zhuanti/zhuanti",
				"iconPath": "static/tab/category.png",
				"selectedIconPath": "static/tab/category_cur.png",
				"text": "专题"
			},
			{
				"pagePath": "pages/my/my",
				"iconPath": "static/tab/tab-my.png",
				"selectedIconPath": "static/tab/tab-my-current.png",
				"text": "我的"
			}
		]
	   },';
        
        $oterpage='{
			"path" : "pages/zhuanti/zhuanti",
			"style" : 
			{
				"navigationBarTitleText" : ""
			}
		},
        {
			"path" : "pages/my/my",
			"style" : 
			{
				"navigationBarTitleText" : ""
			}
		},
        {
			"path" : "pages/article/article",
			"style" : 
			{
				"navigationBarTitleText" : ""
			}
		},
        {
			"path" : "pages/wxlogin/wxlogin",
			"style" : 
			{
				"navigationBarTitleText" : ""
			}
		},
        {
			"path" : "pages/search/search",
			"style" : 
			{
				"navigationBarTitleText" : ""
			}
		},';
        
        
        $this->_content=$_pagesjsonTemplate;
        $this->_content = str_replace("{@#Appname#@}", $this->_AppName, $this->_content);
        $this->_content = str_replace("{@#tabBar#@}", $tabBar, $this->_content);
        $this->_content = str_replace("{@#oterpage#@}", $oterpage, $this->_content);
        
    }
    
    private function makePages()
    {
        
    }
    
    
}